package day03;

import java.util.Scanner;

/**
 * @author yzh
 * @desc TODO
 * @date 2025/4/10
 */
public class NumberReverse {
    public static void main(String[] args) {
        int result = 0;
        Scanner sc = new Scanner(System.in);
        System.out.print("请输入一个整数：");
        int num = sc.nextInt();

        while (num != 0) {
            int digit = num % 10; // 取最后一位数字
            result = result * 10 + digit; // 将数字添加到反转数的末尾
            num = num / 10; // 去掉最后一位
        }

        System.out.println(result);
    }
}
